package experiment5.demo;

import java.net.Socket;

public class Client implements ScreenSayIntf {
    SocketHandler socketHandler;
    Socket clientSocket;

    public void start() {
        try {
            ScreenInput screenInput = new ScreenInput(this);
            screenInput.start();
            clientSocket = new Socket("127.0.0.1", 888);
            socketHandler = new SocketHandler(clientSocket);
            socketHandler.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        Client client = new Client();
        client.start();
    }

    @Override
    public void say(String content) {
        // TODO Auto-generated method stub
        socketHandler.sayTo(content);
    }
}
